package com.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.entity.UserEntity;
import com.service.IUserService;

@RestController
@RequestMapping("/api")
public class Contoller {

    @Autowired
    private IUserService userServie;
	@PostMapping("/user")
	public UserEntity save(@RequestBody UserEntity userInfo) {
		return userServie.insert(userInfo);
	}

	@GetMapping("/users")
	public List<UserEntity> findAll() {
		return userServie.findAll();
	}
}
